package com.fawvwebanma.service.impl;

import java.util.List;

import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Component;

import com.fawvwebanma.api.UserSearchApi;
import com.fawvwebanma.dto.Result;
import com.fawvwebanma.dto.TrainDto;
import com.fawvwebanma.service.ITrainSearchService;

import lombok.extern.slf4j.Slf4j;

/**
 * @author jieye.ren
 * @date 2021/3/12
 */
@Component
@DubboService
@Slf4j
public class TrainSearchService implements ITrainSearchService {
    @DubboReference(version = "${dubbo.provider.version}", check = false, application = "${dubbo.application.id}")
    UserSearchApi userSearchApi;

    @Override
    public Result<List<TrainDto>> getTrainByLeaveAndArriveStationsAndDate(String leaveStation, String arriveStation,
        String date) {
        return Result.success(
            userSearchApi.getTrainByLeaveAndArriveStationsAndDate(leaveStation, arriveStation, date).getData());
    }
}
